return this._engines.get(id);
}
- async _setEngine(id, callback) {
+ async _setEngine(id) {
// Send id even if id == this._currentEngineName
// because 'properties-registered' signal can be emitted
// while this._ibusSources == null on a lock screen.
- if (!this._ready) {
- if (callback)
- callback();
+ if (!this._ready)
return;
- }
try {
await this._ibus.set_global_engine_async(id,
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
logError(e);
}
-
- if (callback)
- callback();
}
- async setEngine(id, callback) {
+ async setEngine(id) {
if (this._oskCompletion)
this._preOskEngine = id;
return;
if (this._oskCompletion)
- this.setCompletionEnabled(false, callback);
+ await this.setCompletionEnabled(false);
else
- await this._setEngine(id, callback);
+ await this._setEngine(id);
}
preloadEngines(ids) {
});
}
- setCompletionEnabled(enabled, callback) {
+ async setCompletionEnabled(enabled) {
/* Needs typing-booster available */
if (enabled && !this._engines.has(TYPING_BOOSTER_ENGINE))
return false;
if (enabled) {
this._preOskEngine = this._currentEngineName;
- this._setEngine(TYPING_BOOSTER_ENGINE, callback);
+ await this._setEngine(TYPING_BOOSTER_ENGINE);
} else if (this._preOskEngine) {
- this._setEngine(this._preOskEngine, callback);
+ await this._setEngine(this._preOskEngine);
delete this._preOskEngine;
}
return true;
Main.inputMethod.commit(str);
}
- set oskCompletion(enabled) {
+ async _setOskCompletion(enabled) {
if (this._oskCompletionEnabled === enabled)
return;
this._oskCompletionEnabled =
- IBusManager.getIBusManager().setCompletionEnabled(enabled, () => Main.inputMethod.update());
+ await IBusManager.getIBusManager().setCompletionEnabled(enabled);
+
+ Main.inputMethod.update();
+ }
+
+ set oskCompletion(enabled) {
+ this._setOskCompletion(enabled);
}
keyvalPress(keyval) {
this._changePerWindowSource();
}
- activateInputSource(is, interactive) {
+ async activateInputSource(is, interactive) {
// The focus changes during holdKeyboard/releaseKeyboard may trick
// the client into hiding UI containing the currently focused entry.
// So holdKeyboard/releaseKeyboard are not called when
else
engine = 'xkb:us::eng';
+ await this._ibusManager.setEngine(engine);
if (!this._reloading)
- this._ibusManager.setEngine(engine, KeyboardManager.releaseKeyboard);
- else
- this._ibusManager.setEngine(engine);
+ KeyboardManager.releaseKeyboard();
+
this._currentInputSourceChanged(is);
if (interactive)